﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Web.Configuration;


namespace HU8.Web.FileExplorer.FileExplorer
{
    public partial class FileUploader : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string TmpID = Request["TmpID"];
            string filters = Request["filters"];
         

            string sizeString = "50mb";
           
            string maxFileSize = string.Format("var max_file_size = \"{0}\";\n", sizeString);

            //筛选器
            string varFilters = "var filters = [ { title: \"文件\", extensions: \"doc,docx,DOC,DOCX\" } ];\n";
            if (!string.IsNullOrEmpty(filters))
            {
                switch (filters)
                {
                    case "image":
                        varFilters = "var filters = [ { title: \"图片\", extensions: \"jpg,gif,png,bmp,svg\" } ];\n";
                        break;
                    case "zip":
                        varFilters = "var filters = [ { title: \"Zip 压缩包\", extensions: \"zip\" } ];\n";
                        break;
                }
            }

            var url = string.Format("var url = \"Upload.ashx?TmpID={0}\";\n", TmpID);//Microsoft.JScript.GlobalObject.encodeURI(path)
            litScript.Text = maxFileSize + varFilters + url;
        }
    }
}